package core.sql.环境;

import org.apache.spark.SparkContext;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * 环境之间的相互转换
 */

public class Spark03_ENV2 {
    public static void main(String[] args) {
        SparkSession sparkSession = SparkSession
                .builder()
                .master("local[*]")
                .appName("Spark03_ENV2")
                .getOrCreate();


        SparkContext sparkContext = sparkSession.sparkContext();


        JavaSparkContext javaSparkContext = new JavaSparkContext(sparkContext);


        JavaRDD<Integer> parallelize = javaSparkContext.parallelize(Arrays.asList(1,2,3,4,10));


        try {


        } catch (Exception e) {
            e.printStackTrace(); // 捕获并打印异常
        } finally {
            sparkSession.close();
        }
    }
}
